<?php
/**
 * Created by PhpStorm.
 * User: Lee
 * Date: 2019/12/18
 * Time: 14:59
 */
namespace App\Repositories\Backend\System;
use App\Common\Exception\ErrorException;
use App\Common\Utils\BaseRepository;
use App\Models\Backend\System\Group;

/**
 * 系统管理-组 (仓库)
 */
class GroupRepository extends BaseRepository
{
    protected $model;

    public function __construct(Group $group)
    {
        $this->model = $group;
    }

    public function getGroupNameById($idArr)
    {
        $row = $this->model->whereIn('id',$idArr)->get(['id','group_name']);
        if ($arr = $row->toArray()){
            return array_combine(array_column($arr,'id'),$arr);
        }else{
            return [];
        }

    }
}
